home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-06 / odipkt.zip / ODIPKT.ASM < prev    next >
Assembly Source File  |  1991-07-04  |  15KB  |  860 lines

  1. ; ODIPKT.ASM - Adapter provides Packet Driver interface over ODI
  2. ;
  3. ; (c) Copyright Daniel D. Lanciani 1991.  All rights reserved.
  4. ;
  5. ; This unmodified source file and its executable form may be used and
  6. ; redistributed freely.  The source may be modified, and the source or
  7. ; executable versions built from the modified source may be used and
  8. ; redistributed, provided that this notice and the copyright displayed by
  9. ; the exectuable remain intact, and provided that the executable displays
  10. ; an additional message indicating that it has been modified, and by whom.
  11. ;
  12. ; Daniel D. Lanciani releases this software "as is", with no express or
  13. ; implied warranty, including, but not limited to, the implied warranties
  14. ; of merchantability and fitness for a particular purpose.
  15. ;
  16. ; Please send bug reports to ddl@harvard.harvard.edu.
  17.  
  18. version    equ    2    ; for driver_info
  19. iftype    equ    71    ; for driver_info/access_type
  20. nhand    equ    8    ; max active handles
  21. mmatch    equ    8    ; max length of header match
  22. mmulti    equ    8    ; max multicast addresses
  23. pkvec    equ    69h    ; default control vector
  24. xbsize    equ    1514    ; max receive frame size
  25. alen    equ    6    ; address length
  26. stksw    equ    1    ; switch stacks in upcall
  27. nopid    equ    1    ; use prescan/default instead on pid
  28. defstk    equ    1    ; use default instead of prescan
  29.  
  30. hinfo    struc            ; per-handle data
  31. nmatch    dw    -1        ; header match length
  32. match    db    mmatch dup (?)    ; header match bytes
  33. recvo    dw    ?        ; receiver offset
  34. recvs    dw    ?        ; receiver segment
  35. hinfo    ends
  36.  
  37. CODE    segment word public 'CODE'
  38.     assume cs:CODE, ds:CODE, es:nothing, ss:CODE
  39.  
  40.     org    100h
  41. stack    label    byte
  42. at100h:    jmp    start
  43.  
  44. copyright db    'ODIPKT 1.0 beta', 13, 10
  45.     db    '(c) Copyright Daniel Lanciani 1991.  All rights reserved.'
  46.     db    13, 10, 'This software is provided with NO WARRANTY.', 13, 10
  47.     db    '$'
  48. myname    db    'ODIPKT', 0    ; for driver_info
  49. class    db    1        ; for driver_info
  50. xbusy    db    0        ; receive buffer busy
  51. ifdef    stksw
  52. inhere    db    0        ; on switched stack
  53. endif
  54.     align    2
  55. savpko    dw    0        ; saved vector offset
  56. savpks    dw    0        ; saved vector segment
  57. psup    dd    0        ; LSL protocol support entry
  58. gsup    dd    0        ; LSL general support entry
  59. control    dd    0        ; MLID control entry
  60. config    dd    0        ; MLID configuration table
  61. asup    dw    0, 0        ; for as_send_pkt
  62. board    dw    0        ; logical board number
  63. myvec    dw    4 * pkvec    ; 4 * my vector
  64. ifndef    nopid
  65. stackid    dw    0        ; stackid from LSL
  66. endif
  67. off    dw    12        ; header offset for match
  68. fmin    dw    60        ; minimum frame size
  69. rmode    dw    3        ; current receiver mode
  70. rmmap    dw    0, 1, 5, 7, 7, 15
  71. nmulti    dw    0        ; number of multicast addresses
  72. mtab    db    mmulti * alen dup (?)
  73. htab    hinfo    nhand dup (<>)    ; the handle table
  74. htabe    label    byte
  75. stab    dw    14 dup (0)    ; for get_statistics
  76. ptab    db    1, 9, 14, alen    ; for get_parameters
  77.     dw    xbsize, mmulti * alen, 0, 0, 0
  78. sECB    db    52 dup (0)    ; transmit ECB
  79. rECB    db    52 dup (0)    ; receive ECB
  80. xb    db    xbsize dup (?)    ; receive buffer
  81.  
  82. upcall    proc    far
  83. transcom:push    ds
  84.     push    bp
  85.     mov    ax, cs
  86.     mov    ds, ax
  87.     mov    ax, asup
  88.     or    ax, asup + 2
  89.     jz    trans1
  90.     mov    ax, es:8[si]
  91.     and    ax, ax
  92.     jz    trans2
  93.     mov    ax, 12
  94.     add    stab + 20, 1
  95.     adc    stab + 22, 0
  96. trans2:    les    di, es:46[si]
  97.     call    dword ptr asup
  98.     mov    cs:asup, 0
  99.     mov    cs:asup + 2, 0
  100. trans1:    pop    bp
  101.     pop    ds
  102.     ret
  103. recvcom:cmp    cs:xbusy, 0
  104.     jnz    nobuf
  105.     mov    dx, ds
  106.     cld
  107.     push    di
  108.     mov    cx, 4[di]
  109.     sub    cx, [di]
  110.     mov    si, cs
  111.     mov    es, si
  112.     mov    ds, si
  113.     mov    xbusy, 1
  114.     mov    si, offset rECB
  115.     mov    word ptr 46[si], offset xb
  116.     add    word ptr 46[si], cx
  117.     mov    word ptr 50[si], xbsize
  118.     sub    word ptr 50[si], cx
  119.     mov    ds, dx
  120.     lds    si, [di]
  121.     mov    di, offset xb
  122.     rep    movsb
  123.     mov    si, offset rECB
  124.     pop    di
  125.     mov    ds, dx
  126.     xor    ax, ax
  127.     ret
  128. nobuf:    mov    ax, 8001h
  129.     add    cs:stab + 16, 1
  130.     adc    cs:stab + 18, 0
  131.     and    ax, ax
  132.     ret
  133.  
  134. recvcom2:push    bp
  135.     push    ds
  136.     push    es
  137.     push    si
  138.     mov    ax, cs
  139.     mov    ds, ax
  140.     cld
  141.     cli
  142. ifdef    stksw
  143.     cmp    inhere, 0
  144.     jz    notbusy
  145.     add    stab + 16, 1
  146.     adc    stab + 18, 0
  147.     jmp    busy
  148. notbusy:inc    inhere
  149.     mov    bx, ss
  150.     mov    cx, sp
  151.     mov    ss, ax
  152.     mov    sp, offset stack
  153.     push    bx
  154.     push    cx
  155. endif
  156.     mov    cx, es:42[si]
  157.     add    cx, es:46[si]
  158.     add    si, 52
  159.     sub    cx, si
  160.     cmp    cx, fmin
  161.     jnc    enuf
  162.     mov    cx, fmin
  163. enuf:    push    es
  164.     push    si
  165.     push    cx
  166.     add    stab, 1
  167.     adc    stab + 2, 0
  168.     add    stab + 8, cx
  169.     adc    stab + 10, 0
  170.     mov    bx, offset htab
  171. recv1:    mov    cx, [bx].nmatch
  172.     cmp    cx, -1
  173.     jz    recv5
  174.     jcxz    recv2
  175.     mov    di, si
  176.     cmp    class, 3
  177.     jnz    norif
  178.     test    byte ptr es:8[di], 80h
  179.     jz    norif
  180.     mov    al, es:14[di]
  181.     and    al, 1fh
  182.     xor    ah, ah
  183.     add    di, ax
  184. norif:    add    di, off
  185.     lea    si, [bx].match
  186.     repe    cmpsb
  187.     jnz    recv5
  188. recv2:    pop    cx
  189.     push    cx
  190.     push    bx
  191.     xor    ax, ax
  192.     call    dword ptr [bx].recvo
  193.     pop    bx
  194.     cld
  195.     mov    ax, es
  196.     or    ax, di
  197.     jz    recv7
  198.     pop    cx
  199.     pop    si
  200.     pop    ds
  201.     push    ds
  202.     push    si
  203.     push    cx
  204.     push    di
  205.     shr    cx, 1
  206.     rep    movsw
  207.     jnc    recv3
  208.     movsb
  209. recv3:    pop    si
  210.     pop    cx
  211.     push    cx
  212.     mov    ax, es
  213.     mov    ds, ax
  214.     push    bx
  215.     mov    ax, 1
  216.     call    dword ptr cs:[bx].recvo
  217.     pop    bx
  218.     cld
  219.     cli
  220.     mov    ax, cs
  221.     mov    ds, ax
  222. recv5:    pop    cx
  223.     pop    si
  224.     pop    es
  225.     add    bx, size hinfo
  226.     cmp    bx, offset htabe
  227.     jnc    recv6
  228.     push    es
  229.     push    si
  230.     push    cx
  231.     jmp    short recv1
  232. recv7:    cli
  233.     mov    ax, cs
  234.     mov    ds, ax
  235.     add    stab + 24, 1
  236.     adc    stab + 26, 0
  237.     jmp    short recv5
  238. recv6:
  239.  
  240. ifdef    stksw
  241.     pop    cx
  242.     pop    bx
  243.     mov    ss, bx
  244.     mov    sp, cx
  245.     dec    inhere
  246. endif
  247. busy:    mov    xbusy, 0
  248.     pop    si
  249.     pop    es
  250.     pop    ds
  251.     pop    bp
  252.     ret
  253. pcont:    mov    ax, 8008h
  254.     and    ax, ax
  255.     ret
  256. upcall    endp
  257.  
  258. nofunc:    mov    dh, 11
  259.     jmp    bad
  260.  
  261. driver_info:pop    bx
  262.     mov    bx, cs
  263.     mov    ds, bx
  264.     mov    bx, version
  265.     mov    ch, class
  266.     mov    dx, iftype
  267.     xor    cl, cl
  268.     mov    si, offset myname
  269.     mov    al, 6
  270.     jmp    good1
  271.  
  272. access_type:pop    bx
  273.     push    ds
  274.     push    cs
  275.     pop    ds
  276.     cmp    al, class
  277.     jz    access_type1
  278.     mov    dh, 2
  279.     jmp    short access_type5
  280. access_type1:cmp    bx, iftype
  281.     jz    access_type7
  282.     cmp    bx, -1
  283.     jz    access_type7
  284.     mov    dh, 3
  285.     jmp    short access_type5
  286. access_type7:and    dl, dl
  287.     jz    access_type2
  288.     mov    dh, 4
  289.     jmp    short access_type5
  290. access_type2:cmp    cx, mmatch + 1
  291.     jc    access_type3
  292.     mov    dh, 14
  293.     jmp    short access_type5
  294. access_type3:mov    bx, offset htab
  295. access_type4:cmp    [bx].nmatch, -1
  296.     jz    access_type6
  297.     add    bx, size hinfo
  298.     cmp    bx, offset htabe
  299.     jc    access_type4
  300.     mov    dh, 9
  301. access_type5:pop    ds
  302.     jmp    bad1
  303. access_type6:mov    [bx].nmatch, cx
  304.     mov    [bx].recvo, di
  305.     mov    [bx].recvs, es
  306.     mov    di, ds
  307.     mov    es, di
  308.     lea    di, [bx].match
  309.     pop    ds
  310.     rep    movsb
  311.     mov    ax, bx
  312.     jmp    good1
  313.  
  314. release_type:pop    bx
  315.     mov    cs:[bx].nmatch, -1
  316.     jmp    good1
  317.  
  318. send_pkt:sti
  319.     push    ds
  320.     mov    bx, ds
  321.     mov    ax, cs
  322.     mov    ds, ax
  323.     mov    es, ax
  324. send_pkt1:cmp    word ptr 8 + sECB, 0
  325.     jg    send_pkt1
  326.     add    stab + 4, 1
  327.     adc    stab + 6, 0
  328.     add    stab + 12, cx
  329.     adc    stab + 14, 0
  330.     mov    word ptr sECB + 42, cx
  331.     mov    word ptr sECB + 46, si
  332.     mov    word ptr sECB + 48, bx
  333.     mov    word ptr sECB + 50, cx
  334.     mov    si, offset sECB
  335.     mov    bx, 12
  336.     call    psup
  337.     sti
  338. send_pkt2:cmp    word ptr 8 + sECB, 0
  339.     jg    send_pkt2
  340.     jnz    send_pkt3
  341.     pop    ds
  342.     jmp    good
  343. send_pkt3:add    stab + 20, 1
  344.     adc    stab + 22, 0
  345.     pop    ds
  346.     mov    dh, 12
  347.     jmp    bad
  348.  
  349. terminate:push    ds
  350.     mov    ax, cs
  351.     mov    ds, ax
  352.     mov    cx, nmulti
  353.     jcxz    terminate2
  354.     mov    si, offset mtab
  355. terminate1:push    si
  356.     push    cx
  357.     mov    ax, cs
  358.     mov    es, ax
  359.     mov    ax, board
  360.     mov    bx, 3
  361.     call    control
  362.     pop    cx
  363.     pop    si
  364.     add    si, alen
  365.     loop    terminate1
  366. terminate2:xor    ax, ax
  367.     mov    es, ax
  368.     mov    bx, myvec
  369.     mov    ax, savpko
  370.     mov    es:[bx], ax
  371.     mov    ax, savpks
  372.     mov    es:2[bx], ax
  373. ifdef    nopid
  374.     mov    ax, board
  375. ifdef    defstk
  376.     mov    bx, 9
  377. else
  378.     mov    bx, 11
  379. endif
  380.     call    psup
  381. else
  382.     mov    ax, stackid
  383.     mov    bx, 22
  384.     mov    cx, board
  385.     call    psup
  386.     mov    ax, stackid
  387.     mov    bx, 7
  388.     call    psup
  389. endif
  390.     mov    ax, cs
  391.     mov    es, ax
  392.     mov    ah, 49h
  393.     int    21h
  394.     pop    ds
  395.     jmp    good
  396.  
  397. get_address:cmp    cx, alen
  398.     jnc    get_address1
  399.     mov    dh, 9
  400.     jmp    bad
  401. get_address1:push    ds
  402.     lds    si, cs:config
  403.     add    si, 28
  404.     mov    cx, alen
  405.     rep    movsb
  406.     pop    ds
  407.     mov    cx, alen
  408.     jmp    good
  409.  
  410. reset_interface:mov    dh, 15
  411.     jmp    bad
  412.  
  413. get_parameters:mov    di, cs
  414.     mov    es, di
  415.     mov    di, offset ptab
  416.     jmp    good
  417.  
  418. as_send_pkt:sti
  419.     push    ds
  420.     mov    bx, ds
  421.     mov    ax, cs
  422.     mov    ds, ax
  423. as_send_pkt1:cmp    word ptr 8 + sECB, 0
  424.     jg    as_send_pkt1
  425.     cli
  426.     mov    asup, di
  427.     mov    asup + 2, es
  428.     sti
  429.     mov    es, ax
  430.     add    stab + 4, 1
  431.     adc    stab + 6, 0
  432.     add    stab + 12, cx
  433.     adc    stab + 14, 0
  434.     mov    word ptr sECB + 42, cx
  435.     mov    word ptr sECB + 46, si
  436.     mov    word ptr sECB + 48, bx
  437.     mov    word ptr sECB + 50, cx
  438.     mov    si, offset sECB
  439.     mov    bx, 12
  440.     call    psup
  441.     sti
  442.     pop    ds
  443.     jmp    good
  444.  
  445. set_rcv_mode:mov    bx, cx
  446.     dec    bx
  447.     cmp    bx, 6
  448.     jnc    set_rcv_mode1
  449.     shl    bx, 1
  450.     push    cx
  451.     mov    ax, cs:rmmap[bx]
  452.     mov    bx, 4
  453.     mov    cx, -1
  454.     call    cs:control
  455.     pop    cx
  456. ;    jnz    set_rcv_mode1    ; XXX no longer supported by ODI
  457.     mov    cs:rmode, cx
  458.     jmp    good
  459. set_rcv_mode1:mov    dh, 8
  460.     jmp    bad
  461.  
  462. get_rcv_mode:mov    ax, cs:rmode
  463.     jmp    good
  464.  
  465. set_multicast_list:mov    ax, cx
  466.     xor    dx, dx
  467.     mov    bx, alen
  468.     div    bx
  469.     and    dx, dx
  470.     jz    set_multicast_list1
  471.     mov    dh, 14
  472.     jmp    bad
  473. set_multicast_list1:cmp    ax, mmulti + 1
  474.     jc    set_multicast_list6
  475.     mov    dh, 9
  476.     jmp    bad
  477. set_multicast_list6:push    ds
  478.     push    cx
  479.     push    ax
  480.     push    es
  481.     push    di
  482.     mov    ax, cs
  483.     mov    ds, ax
  484.     mov    cx, nmulti
  485.     jcxz    set_multicast_list3
  486.     mov    si, offset mtab
  487. set_multicast_list2:push    si
  488.     push    cx
  489.     mov    ax, cs
  490.     mov    es, ax
  491.     mov    ax, board
  492.     mov    bx, 3
  493.     call    control
  494.     pop    cx
  495.     pop    si
  496.     add    si, alen
  497.     loop    set_multicast_list2
  498. set_multicast_list3:pop    si
  499.     pop    ds
  500.     pop    ax
  501.     pop    cx
  502.     mov    bx, cs
  503.     mov    es, bx
  504.     mov    di, offset mtab
  505.     cld
  506.     rep    movsb
  507.     mov    bx, cs
  508.     mov    ds, bx
  509.     mov    nmulti, ax
  510.     mov    cx, ax
  511.     jcxz    set_multicast_list5
  512.     mov    si, offset mtab
  513. set_multicast_list4:push    si
  514.     push    cx
  515.     mov    ax, cs
  516.     mov    es, ax
  517.     mov    ax, board
  518.     mov    bx, 2
  519.     call    control
  520.     pop    cx
  521.     pop    si
  522.     add    si, alen
  523.     loop    set_multicast_list4
  524. set_multicast_list5:pop    ds
  525.     jmp    good
  526.  
  527. get_multicast_list:mov    di, cs
  528.     mov    es, di
  529.     mov    di, offset mtab
  530.     mov    ax, cs:nmulti
  531.     mov    cx, alen
  532.     mul    cx
  533.     mov    cx, ax
  534.     jmp    good
  535.  
  536. get_statistics:mov    si, cs
  537.     mov    ds, si
  538.     mov    si, offset stab
  539.     jmp    good
  540.  
  541. set_address:mov    dh, 13
  542.     jmp    bad
  543.  
  544. funcs    dw    nofunc
  545.     dw    driver_info
  546.     dw    access_type
  547.     dw    release_type
  548.     dw    send_pkt
  549.     dw    terminate
  550.     dw    get_address
  551.     dw    reset_interface
  552.     dw    nofunc
  553.     dw    nofunc
  554.  
  555.     dw    get_parameters
  556.     dw    as_send_pkt
  557.     dw    nofunc
  558.     dw    nofunc
  559.     dw    nofunc
  560.     dw    nofunc
  561.     dw    nofunc
  562.     dw    nofunc
  563.     dw    nofunc
  564.     dw    nofunc
  565.  
  566.     dw    set_rcv_mode
  567.     dw    get_rcv_mode
  568.     dw    set_multicast_list
  569.     dw    get_multicast_list
  570.     dw    get_statistics
  571.     dw    set_address
  572.  
  573. nfuncs    equ    ($ - offset funcs) / 2
  574.  
  575. intpk    proc    far
  576.     jmp    short dopk
  577.     nop
  578. sig    db    'PKT DRVR', 0
  579. dopk:    cli
  580.     cld
  581.     push    bx
  582.     cmp    ah, nfuncs
  583.     jc    dopk1
  584.     jmp    nofunc
  585.  
  586. dopk1:    mov    bl, ah
  587.     xor    bh, bh
  588.     shl    bx, 1
  589.     jmp    cs:funcs[bx]
  590.  
  591. bad:    pop    bx
  592. bad1:    stc
  593.     sti
  594.     ret    2
  595. good:    pop    bx
  596. good1:    clc
  597.     sti
  598.     ret    2
  599. intpk    endp
  600.  
  601. start:    mov    ax, cs
  602.     mov    ds, ax
  603.     cld
  604.  
  605.     mov    dx, offset copyright
  606.     mov    ah, 9
  607.     int    21h
  608.  
  609.     mov    bx, 81h
  610.     call    space
  611.     call    number
  612.     jc    start0
  613.     mov    board, ax
  614.     call    space
  615.     call    number
  616.     jc    start0
  617.     add    ax, ax
  618.     add    ax, ax
  619.     mov    myvec, ax
  620.  
  621. start0:    xor    ax, ax
  622.     mov    es, ax
  623.     mov    bx, myvec
  624.     les    di, es:[bx]
  625.     add    di, 3
  626.     mov    si, offset sig
  627.     mov    cx, 9
  628.     repe    cmpsb
  629.     jnz    start1
  630.     mov    dx, offset already
  631. pexit:    mov    ah, 9
  632.     int    21h
  633.     int    20h
  634.  
  635. start1:    xor    ax, ax
  636.     mov    es, ax
  637.     xor    bx, bx
  638.     xor    dx, dx
  639.     mov    ah, 0c0h
  640. start11:push    ax
  641.     int    2fh
  642.     cmp    al, 0ffh
  643.     pop    ax
  644.     jz    start13
  645. start12:inc    ah
  646.     jnz    start11
  647.     mov    dx, offset nolsl
  648.     jmp    pexit
  649. start13:mov    ax, dx
  650.     or    ax, bx
  651.     jz    start12
  652.     mov    di, si
  653.     mov    si, offset lslname
  654.     cld
  655.     mov    cx, 8
  656.     repe    cmpsb
  657.     jz    start14
  658.     xor    bx, bx
  659.     xor    dx, dx
  660.     jmp    start12
  661.  
  662. start14:mov    word ptr psup, bx
  663.     mov    word ptr psup + 2, dx
  664.     mov    si, cs
  665.     mov    es, si
  666.     mov    si, offset psup
  667.     mov    bx, 2
  668.     call    psup
  669.     mov    ax, word ptr gsup
  670.     or    ax, word ptr gsup + 2
  671.     jnz    start2
  672.     mov    dx, offset lslfail
  673.     jmp    pexit
  674.  
  675. start2:    mov    bx, 18
  676.     mov    ax, board
  677.     call    psup
  678.     jz    start3
  679.     mov    dx, offset nocont
  680.     jmp    pexit
  681. start3:    mov    word ptr control, si
  682.     mov    word ptr control + 2, es
  683.     mov    ax, board
  684.     xor    bx, bx
  685.     call    control
  686.     jz    start4
  687.     mov    dx, offset noconf
  688.     jmp    pexit
  689. start4:    mov    word ptr config, si
  690.     mov    word ptr config + 2, es
  691.     mov    al, es:114[si]
  692.     cmp    al, 8
  693.     jnc    noloirq
  694.     xor    ah, ah
  695.     add    ax, 8
  696.     mov    word ptr ptab + 12, ax
  697. noloirq:mov    ax, es:60[si]
  698.     cmp    ax, 4
  699.     jz    istok
  700.     cmp    ax, 11
  701.     jz    istok
  702.     cmp    ax, 3
  703.     jz    is8023
  704.     cmp    ax, 5
  705.     jz    is8023
  706.     cmp    ax, 10
  707.     jz    is8023
  708.     jmp    short gottype
  709. istok:    mov    off, 14
  710.     mov    ax, es:40[si]
  711.     add    ax, 14
  712.     cmp    ax, xbsize + 1
  713.     jc    istok1
  714.     mov    ax, xbsize
  715. istok1:    mov    word ptr ptab + 4, ax
  716.     mov    class, 3
  717.     mov    fmin, 14
  718.     jmp    short gottype
  719. is8023:    mov    off, 14
  720.     mov    class, 11
  721. gottype:
  722.  
  723. ifdef    nopid
  724.     mov    rinfo, offset recvcom
  725.     mov    rinfo + 2, cs
  726.     mov    rinfo + 4, offset pcont
  727.     mov    rinfo + 6, cs
  728.     mov    si, cs
  729.     mov    es, si
  730.     mov    si, offset rinfo
  731.     mov    ax, board
  732. ifdef    defstk
  733.     mov    bx, 8
  734. else
  735.     mov    bx, 10
  736. endif
  737.     call    psup
  738.     jz    start5
  739.     mov    dx, offset rfail
  740.     jmp    pexit
  741. else
  742.     mov    rinfo, offset sname
  743.     mov    rinfo + 2, cs
  744.     mov    rinfo + 4, offset recvcom
  745.     mov    rinfo + 6, cs
  746.     mov    rinfo + 8, offset pcont
  747.     mov    rinfo + 10, cs
  748.     mov    si, cs
  749.     mov    es, si
  750.     mov    si, offset rinfo
  751.     mov    bx, 6
  752.     call    psup
  753.     jz    start51
  754.     mov    dx, offset rfail
  755.     jmp    pexit
  756. start51:mov    stackid, bx
  757.     mov    ax, bx
  758.     mov    bx, 21
  759.     mov    cx, board
  760.     call    psup
  761.     jz    start5
  762.     mov    ax, stackid
  763.     mov    bx, 7
  764.     call    psup
  765.     mov    dx, offset bfail
  766.     jmp    pexit
  767. endif
  768.  
  769. start5:    mov    word ptr sECB + 10, offset transcom
  770.     mov    word ptr sECB + 12, cs
  771.     mov    word ptr sECB + 14, -1
  772.     mov    ax, board
  773.     mov    word ptr sECB + 22, ax
  774.     mov    word ptr sECB + 44, 1
  775.  
  776.     mov    word ptr rECB + 10, offset recvcom2
  777.     mov    word ptr rECB + 12, cs
  778.     mov    word ptr rECB + 14, -1
  779.     mov    ax, board
  780.     mov    word ptr rECB + 22, ax
  781.     mov    word ptr rECB + 44, 1
  782.     mov    word ptr rECB + 48, cs
  783.  
  784.     xor    ax, ax
  785.     mov    es, ax
  786.     pushf
  787.     cli
  788.     mov    bx, myvec
  789.     mov    ax, es:[bx]
  790.     mov    savpko, ax
  791.     mov    ax, es:2[bx]
  792.     mov    savpks, ax
  793.     mov    es:[bx], offset intpk
  794.     mov    es:2[bx], cs
  795.     popf
  796.  
  797.     mov    dx, offset goodins
  798.     mov    ah, 9
  799.     int    21h
  800.  
  801.     mov    es, ds:[2ch]
  802.     mov    ah, 49h
  803.     int    21h
  804.     mov    word ptr ds:[2ch], 0
  805.  
  806.     mov    cx, 5
  807.     xor    bx, bx
  808. cloop:    mov    ah, 3eh
  809.     int    21h
  810.     inc    bx
  811.     loop    cloop
  812.  
  813.     mov    dx, offset start
  814.     int    27h
  815.  
  816. number:    xor    ax, ax
  817.     mov    cx, -1
  818. number1:cmp    byte ptr [bx], '0'
  819.     jc    number2
  820.     cmp    byte ptr [bx], '9' + 1
  821.     jnc    number2
  822.     xor    cx, cx
  823.     mov    dx, 10
  824.     mul    dx
  825.     mov    dl, byte ptr [bx]
  826.     sub    dl, '0'
  827.     xor    dh, dh
  828.     add    ax, dx
  829.     inc    bx
  830.     jmp    short number1
  831. number2:add    cx, 1
  832.     ret
  833.  
  834. space:    cmp    byte ptr [bx], ' '
  835.     jz    space1
  836.     cmp    byte ptr [bx], 9
  837.     jz    space1
  838.     ret
  839. space1:    inc    bx
  840.     jmp    short space
  841.  
  842. ifdef    nopid
  843. rinfo    dw    4 dup (0)
  844. else
  845. sname    db    6, 'ODIPKT', 0
  846. rinfo    dw    6 dup (0)
  847. bfail    db    'Failed to bind protocol stack', 13, 10, '$'
  848. endif
  849. lslname    db    'LINKSUP$'
  850. already    db    'A driver is already installed at this vector.', 13, 10, '$'
  851. goodins    db    'ODIPKT is installed and ready.', 13, 10, '$'
  852. nolsl    db    'The Link Support Layer is not loaded.', 13, 10, '$'
  853. lslfail    db    'The Link Support Layer failed to init.', 13, 10, '$'
  854. nocont    db    'Cannot get MLID control entry', 13, 10, '$'
  855. noconf    db    'Cannot get MLID configuration', 13, 10, '$'
  856. rfail    db    'Failed to register protocol stack', 13, 10, '$'
  857.  
  858. CODE    ends
  859.     end    at100h
  860.